# -*- coding: utf-8 -*-
import datetime

a = [4, 5, 6]
b = [1]
d = (1, 3, 5)
e = (1, 3, 5)

def request_model_train_hotwords(pid):
    print("##################列表##################")
    #切片
    print(a)
    print(a[:])
    print(a[0:])
    print(a[0:1])

    # 序列相加
    print(a + b)

    # 乘法
    print(a * 3)

    # 检查
    print(3 in a)
    print(3 not in a)

    # 长度、最大值、最小值
    print(len(a))
    print(max(a))
    print(min(a))

    # 访问单个元素
    print(a[2])

    # 遍历
    for item in a:
        print("item = " + str(item))

    for index,item in enumerate(a):
        print(str(index) + " = " + str(item))

    # 添加元素
    a.append(10)
    print(a)
    a.insert(0, 10)
    print(a)
    a.extend(b)
    print(a)

    # 删除元素
    del a[len(a) - 1]
    print(a)
    a.remove(10) # 只删除了第一个
    print(a)
    a.pop(3)
    print(a)

    # 检查元素
    print(a.count(6))
    print(a.index(6))
    print(sum(a))

    # 排序
    a.sort(reverse=True)
    print(a)

    # 推导术
    c = [item for item in a if item > 6]
    print(c)

    print("##################元组##################")
    print(d)
    print(d + e)

    print("##################字典##################")
    f = {"name":"lpc", "num":1}
    g = dict(name = 'lpc', num = 11)
    print(f)
    print(g)
    print(dict(zip(a, b)))
    g.clear()
    print(g)

    for item in f.items():
        print(item,end=' ')
    print("---")
    for key, value in f.items():
        print(key, "=", value,end=' ')
    print("---")
    for key in f.keys():
        print(key,end=' ')
    print("---")
    for value in f.values():
        print(value,end=' ')
    print("---")

    f["age"] = 30
    print(f)
    f["age"] = 33
    print(f)
    print(f["age"])
    print(f.get("sex", 1))

    print("##################集合##################")
    h = set([1, 3, 5])
    i = set((1, 2, 3))
    j = {1, 3, 5}
    print(h & i)
    print(h | i)
    print(h - i)
    print(j)

if __name__ == "__main__":
    request_model_train_hotwords(1207)